<div id="top-panel">
    <div id="panel">
        
    </div>
</div>
<script type="text/javascript" src="https://www.google.com/jsapi"></script>
<script type="text/javascript">

      // Load the Visualization API and the piechart package.
      google.load('visualization', '1.0', {'packages':['corechart']});

      // Set a callback to run when the Google Visualization API is loaded.
      google.setOnLoadCallback(drawChart);

      // Callback that creates and populates a data table,
      // instantiates the pie chart, passes in the data and
      // draws it.
      function drawChart() {

        // Create the data table.
        var data = new google.visualization.DataTable();
        data.addColumn('string', 'Topping');
        data.addColumn('number', 'Slices');
       /* var data = google.visualization.arrayToDataTable([
          ['Year', 'Sales', 'Expenses'],
          ['2004',  1000,      400],
          ['2005',  1170,      460],
          ['2006',  660,       1120],
          ['2007',  1030,      540]
        ]);*/
		var data = google.visualization.arrayToDataTable(<?php echo $chart; ?>);

        // Set chart options
        var options = {'title':'Top 5 highest donate',
                       'width':400,
                       'height':300};

        // Instantiate and draw our chart, passing in some options.
        var chart = new google.visualization.ColumnChart(document.getElementById('chart_div'));
        chart.draw(data, options);
      }
    </script>
<div id="wrapper">
	<div id="content">
		
		<div id="rightnow">
			<h3 class="reallynow">EKOKIOSK</h3>
			<p>Right now we have <?php echo $total_kiosk; ?> EKOKIOSK devices</p>
		</div>
		
		<div id="infowrap">
			
			<div id="infobox">
				<h3>Latest 5 Donate</h3>
				<?php if (count($latest_donate)): ?>
				<table>
					<thead>
						<tr>
							<th>KIOSK Name</th>
							<th>Date</th>
							<th>Donate</th>
						</tr>
					</thead>
					<tbody>
						<?php foreach($latest_donate as $v): ?>
						<tr>
							<td><?php echo $v['name']; ?></td>
							<td><?php echo date('Y-m-d h:i:s', strtotime($v['date'])); ?></td>
							<td><?php echo $v['donate']; ?></td>
						</tr>
						<?php endforeach; ?>
					</tbody>
				</table>
				<?php else: ?>
				<p>No data</p>
				<?php endif; ?>
			</div>
			
			<div id="infobox" class="margin-left">
				<h3>Top 5 Donate</h3>
				<?php if (count($top5)): ?>
				<table>
					<thead>
						<tr>
							<th>KIOSK Name</th>							
							<th>Donate</th>
						</tr>
					</thead>
					<tbody>
						<?php foreach($top5 as $v): ?>
						<tr>
							<td><a href="<?php echo site_url('fund/filter/'.$v['id']); ?>"><?php echo $v['name']; ?></a></td>
							<td><?php echo $v['total_donate']; ?></td>
						</tr>
						<?php endforeach; ?>
					</tbody>
				</table>
				<?php else: ?>
				<p>No data</p>
				<?php endif; ?>
			</div>		
		</div>
		<div style="clear:both;"></div>
		<div style="margin:5px 0;">&nbsp;</div>
		<div id="box">
			<h3>Top 5 Donate Chart</h3>
			<div id="chart_div"></div>
		</div>
		
	</div>
</div>